function submit_form(form, val) {
    if (form.question.value == "") {
        alert("请输入问题");
        form.question.focus();
        return false;
    }

    if (val == 1) {
        form.askorsearch.value = 'ask';
        // document.getElementById("askorsearch").value='ask';
    }
    else if (val == 2) {
        form.askorsearch.value = 'search';
        // document.getElementById("askorsearch").value='search';
    }
    form.submit();

}


//获取域名
// host = window.location.host;
// domain = document.domain;

//获取页面完整地址
url = "http://" + window.location.host + '/';
console.log(url)

// pstart = url.indexOf("?page=")
// url = url.slice(domain.length, pstart)
// console.log(url)

// document.getElementById('right').href = url + document.getElementById('right').href;
// document.getElementById('left').href = url + document.getElementById('left').href;

// console.log(document.getElementById('right').href)

// function(number){
//     window.location.href=url + "?page="
// }

function next(number) {
    if (url.indexOf("?page=") != -1) {
        url = url.replace(/\?page=[0-9]+/, '?page=' + number)
    }
    else{
        url = url + "?page=" + number;
    }
    // console.log(url)
    window.location.assign(url);

}

function prev(number) {
    url = url.replace(/\?page=[0-9]+/, '?page=' + number)
    window.location.assign(url)
}
